package com.chj.design.observer;

import com.google.common.eventbus.EventBus;
import org.springframework.stereotype.Component;

@Component
public class EventBusCenter {

    private static EventBus eventBus = new EventBus();

    //添加观察者
    public void register(Object obj) {
        eventBus.register(obj);
    }

    //移除观察者
    public void unregister(Object obj) {
        eventBus.unregister(obj);
    }

    //把消息推给观察者
    public void post(Object obj) {
        eventBus.post(obj);
    }


}
